<!DOCTYPE html>
<html>
	<head>
		<meta name="layout" content="kickstart">
		<title>Mr-Rights|Profilo|Cambio Password</title>
		<script type="text/javascript">
		function resetMessage(){
			$.SmartMessageBox({
				title : "<div class='row'><div class='col-md-2'><i class='fa '></i></div><div class='col-md-10'>Stai per resettare la tua password con la tua prima password!</div>",
				content : "<div class='col-md-2'></div><div class='col-md-10'> Sei sicuro di volerlo fare?<BR/><BR/></div></div>",
				buttons:"[Si],[No]",
				sound:false
			}, function(ButtonPressed, Value) {
				if (ButtonPressed === "No") {
					
				}
				if (ButtonPressed === "Si") {
					${remoteFunction(asynchronous: true,
		 					action:'reset_pass',
							controller:'profile',
							onSuccess:'showResetPswResponse(data)'
							)} 
				}
				});
			
		}
		function showResetPswResponse(data){
			$.smallBox({
				title : data.message,
				color : "#3F8DBF",
				sound:false,
				timeout: 3000,
				icon : "fa fa-lock"
			});
			}
		</script>
	</head>
	<body>
	
	<div id="ribbon">
				
								<!-- breadcrumb -->
		<ol class="breadcrumb">
			<li>Profilo</li><li>Cambio Password</li>
		</ol>
				<!-- end breadcrumb -->				
			
	</div>
	
	<div id="content">
	
	<div class="row">
		<div class="col-xs-12 col-sm-7 col-md-7 col-lg-7">
			<h1 class="page-title txt-color-blueDark">
			<i class="fa-fw fa fa-user"></i><sec:loggedInUserInfo field="username"/><span>&nbsp;>&nbsp;</span><span>Cambio Password</span></h1>
		</div>
					
	</div>
	
	
	<g:if test='${flash.message}'>
	<div class="alert alert-block alert-danger">
		<a class="close" data-dismiss="alert" href="#">×</a>
		<h4 class="alert-heading"><i class="fa fa-check-square-o"></i> Cambio Password</h4>
		<p>
			${flash.message}
		</p>
		</div>
      
      </g:if>
	<g:if test="${success}">
		<div class="alert alert-block alert-success">
		<a class="close" data-dismiss="alert" href="#">×</a>
		<h4 class="alert-heading"><i class="fa fa-check-square-o"></i> Password cambiata!</h4>
		<p>
			La tua password è stata cambiata con successo!
		</p>
		</div>
	</g:if>
     <form id="smart-form-register"  action="${createLink(action: 'password')}" method="POST">
							<div class="row">
							<br/><br/>
								<div class="col-md-4 col-md-offset-1 ">
								<div class="form-group">
										<div class="input-group">
											<span class="input-group-addon"><i class="fa fa-lock fa-lg fa-fw"></i></span>
												<input class="form-control input-md"  type="password" name="password" placeholder="Password attuale" id="password">
										</div>
								</div>
								
								</div>

								</div>
								<div class="row">
								<div class="col-md-4 col-md-offset-1">
								<div class="form-group">
										<div class="input-group">
											<span class="input-group-addon"><i class="fa fa-lock fa-lg fa-fw"></i></span>
												<input class="form-control input-md"  type="password" name="new_password" placeholder="Nuova Password" >
										</div>
								</div>
								
								
								</div>
								<div class="col-md-4 col-md-offset-1 ">
								<div class="form-group">
										<div class="input-group">
											<span class="input-group-addon"><i class="fa fa-lock fa-lg fa-fw"></i></span>
												<input class="form-control input-md"  type="password" name="re_new_password" placeholder="Conferma Nuova Password" >
										</div>
								</div>
								</div>
								</div>
							
							<div class="row"><br/><br/></div>
							<div class="row">
								<div class="col-md-4 col-md-offset-1">
								<button type="submit" class="btn btn-lg btn-primary" data-loading-text="Sto cambiando la passord...">
									Cambia Password
								</button>
								</div>
							</div>
			
						</form>
						<div class="row">
							<br/>
							<br/>
							<br/>
								<div class="col-md-4 col-md-offset-1">
									<button onclick="resetMessage();" class="btn btn-lg btn-danger" data-loading-text="Sto cambiando la passord...">
										Reimposta password iniziale
									</button>
								</div>
							</div>	
		</div>
</body>
</html>						
										